﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using Karbel; 
using Ersur.DevTeam;

namespace Ersur
{
    public partial class AddProduct : XPopupForm
    {
        public AddProduct()
        {
            InitializeComponent();            
        }


        public int ProductId
        {
            get
            {
                return Convert.ToInt32(gleProduct.EditValue);
            }
        }

        private void AddProduct_Load(object sender, EventArgs e)
        { 
            gleProduct.Properties.Assign(Utility.GetAutoCompGLE(Data.DB.Product, "Article","ProductId"));
        }

        private void AddProduct_BarcodeRead(int Barcode)
        {
            gleProduct.EditValue = Barcode;
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
        }

        private void gleProduct_EditValueChanged(object sender, EventArgs e)
        {
            if (ProductId > 0)
                btnAdd.Enabled = true;
        }
    }
}